<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/page/public/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>线索库</title>
<% request.setAttribute("menu", 1); %>
<%@ include file="/WEB-INF/page/public/contentmeta.jsp"%>
<script type="text/javascript" src="<%=basePath%>js/insert.js"></script>
<link rel="stylesheet" href="<%=basePath%>css/global.css" media="all" />
<link rel="stylesheet" href="<%=basePath%>plugins/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="<%=basePath%>css/tab.css" media="all" />



<style type="text/css">
	.layui-form-label i { color:red; padding-right: 3px; }
	
	.addbg{width:380px;background:#2591d0;color:#fff;cursor:default;}
	.first{border:1px solid #c9c9c9;width:300px;border-radius:2px;}
	#append{width:380px;height:auto;background:#ffffff;border:1px solid #c9c9c9;display:none;border-radius:2px;margin-top:10px;position:absolute;z-index:99999;}
	.item{width:380px;height:30px;line-height:30px;}
</style>

</head>
<body>

	<input type="hidden" id="successlog" value="${successlog}">
	<input type="hidden" value="${customertype}" id="customertype">
	
	<div class="admin-tab TM-tab">
		<div class="layui-tab layui-tab-card">
			<%@ include file="/WEB-INF/page/customermanage/customerlistmenu.jsp" %>
			<div class="layui-tab-content">
				<div class="layui-tab-item layui-show">
					<div class="tab-condition">
					
						<%@ include file="/WEB-INF/page/customermanage/customerlistform.jsp"%>
						
						<div class="TM-tab-info">
							<a class="layui-btn layui-btn-primary layui-btn-small  insertbtn"  typedata="${customertype}" statedata="${customerstate}"><i class="layui-icon">&#xe62f;</i>导入资源</a>
							<a class="layui-btn layui-btn-primary layui-btn-small  hdcxbtn"><i class="layui-icon">&#xe615;</i>检索录入</a>
							<a class="layui-btn layui-btn-primary layui-btn-small  dksqbtn"><i class="layui-icon">&#xe621;</i>申请垫款</a>
							<a class="layui-btn layui-btn-primary layui-btn-small yysjbtn"><i class="layui-icon">&#xe654;</i>添加预约</a>
							<a class="layui-btn layui-btn-primary layui-btn-small fqbtn"><i class="layui-icon">&#x1006;</i>批量放弃</a>
							<a class="layui-btn layui-btn-primary layui-btn-small  refreshbtn"><i class="layui-icon">&#x1002;</i>刷新</a>
						</div>
					</div>
					<div class="layui-field-box">
						<table class="site-table table-hover TM-table3">
							<thead>
							<tr>
								<th style="width:5%;"><input type="checkbox" id="selected-all" name="customcheck"/></th>
								<th style="width:10%;" >姓名</th>
								<th style="width:10%;">联系电话</th>
								<th style="width:10%;">地区</th>
								<th style="width:20%;">证书及专业</th>
								<th style="width:10%;">身份证</th>
								<th style="width:10%;">最新联系时间</th>
								<th style="width:10%">是否聘用</th>
								<th style="width:15%;">操作</th>
							</tr>
							</thead>
							<tbody>
							<c:forEach var="obj" items="${pager.resultList}" varStatus="o1">
							<tr class="<c:if test="${obj.dystate == 0}">blue</c:if><c:if test="${obj.dystate == 2}">yellow</c:if><c:if test="${obj.dystate == 3}">red</c:if>">
									<td><input type="checkbox" name="customcheckbox" value="${obj.id}" data="${obj.dystate}"  dname="${obj.cname}" /></td>
									<td  id="dhlxr">${obj.cname}</td>
									<td>${obj.tel}</td>
									<td><dic:str value="${obj.address}"  maxLength="6"/> </td>
									<td>
										${obj.technicalpost}
									</td>
									<td data="${obj.id}">
										${obj.idcard}
									</td>
									<td class="TM_hover seenote seenote${obj.id}" data="${obj.id}">
										<c:if test="${fn:length(obj.cDynaicItem) > 0}">
											${obj.updatedate.substring(0,10)}
										</c:if>
										<c:if test="${fn:length(obj.cDynaicItem) < 1}">
											暂无联系记录
										</c:if>
									</td>
									<td > 
									   <c:if test="${obj.gaokaoQYSize > 0}">
											已聘用
										</c:if>
										<c:if test="${obj.gaokaoQYSize==0}">
											未聘用
										</c:if>
									</td>
									<td data="${obj.id}">
										<button type="button"  class="layui-btn layui-btn-normal layui-btn-mini xgbtn" data="${obj.id}">管理</button>
										<button type="button"  class="layui-btn layui-btn-normal layui-btn-mini fqbtn1" data="${obj.id}">放弃</button>
										<button type="button"  class="layui-btn layui-btn-normal layui-btn-mini lxjlbtn" data="${obj.id}">跟进</button>
										<c:if test="${sessionScope.user.id==1}">
									    <button type="button"   class="layui-btn layui-btn-normal layui-btn-mini hszbtn " data="${obj.id}">删除</button>
										</c:if>
									</td>
								</tr>
							</c:forEach>
							</tbody>
						</table>
						<ul class="clefix differ">
						    <li class="contact1"><input type="checkbox" class="lx_checkbox1" id="yyck1" data="2"/><span><label for="yyck1">已联系</label></span></li>
							<li class="contact3"><input type="checkbox" class="lx_checkbox1"  id="yyck4" data="3"/><span><label for="yyck4">紧急联系</label></span></li>
							<li class="contact2"><input type="checkbox" class="lx_checkbox1"  id="yyck2" data="0"/><span><label for="yyck2">已预约</label></span></li>
							<li><input type="checkbox" class="lx_checkbox1" data="99"  id="yyck3"/><span><label for="yyck3">待预约</label></span></li>
						</ul>
						<div class="admin-table-page">
							<div   class="page" ><div class="layui-laypage"  ><span class="layui-laypage-total"><button type="button" class="layui-laypage-btn">共${pager.totalSize}条记录</button></span></div></div>
						</div>
						<div class="admin-table-page">
							<div id="page" class="page"></div>
						</div>
					</div>
				</div>
			</div>
		</div>
		
	</div>
	
	
	
		<!-- 垫款详情弹框 -->
<div id="TM-layui-diankuan" style="display:none;">
	<div class="TM-he-tong admin-entering">
		<form class="layui-form TM-entering-form" action="" id="diankuanform"   novalidate="novalidate">
        <div class="form-left">
            <div class="layui-form-item">
                <label class="layui-form-label">申请人 :</label>
                <div class="layui-input-block dkrname" >${sessionScope.user.info.name}</div>
                 <input type="hidden" name="cusid" id="rcid" >
                  <input type="hidden" name="type" value="0" >
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><i>*</i><span>回款时间 :</span> </label>
               <div class="layui-input-block">
        			<input type="text" name="arrivaltime" id="arrivaltime" readonly="readonly"   placeholder="yyyy-mm-dd" autocomplete="off" class="layui-input" onclick="layui.laydate({elem: this})">
        		</div>
            </div>  
            <div class="layui-form-item">
                <label class="layui-form-label"><i>*</i><span>金额 : </span></label>
                <div class="layui-input-block">
        			<input type="text" name="totalamount" id="totalamount"   autocomplete="off" class="layui-input" >
        		</div>
            </div>   
            <div class="layui-form-item">
                <label class="layui-form-label"><i>*</i><span>户名 : </span></label>
                <div class="layui-input-block">
        			<input type="text" name="name" id="name"   autocomplete="off" class="layui-input" >
        		</div>
            </div> 
            <div class="layui-form-item">
                <label class="layui-form-label"><i>*</i><span>卡号 : </span></label>
                <div class="layui-input-block">
        			<input type="text" name="cardnumber" id="cardnumber" onkeyup="formateBankNo(this)" onkeydown="formateBankNo(this)"  autocomplete="off" class="layui-input" >
        		</div>
            </div>                  
        </div>
        <div class="form-right">
        	<div class="layui-form-item">
                <label class="layui-form-label"><i>*</i><span>付款类型 : </span></label>
                <div class="layui-input-block">
        		  <select name="paytype" lay-filter="paytype">
			        <option value="0" selected="selected">垫款</option>
			      </select>
        		</div>
            </div>
            <div class="layui-form-item warehouse">
               <label class="layui-form-label"><i>*</i><span>证书用途: </span></label>
               <div class="layui-input-block">
			      <select name="usetype" lay-filter="usetype">
			        <option value="0">挂资质</option>
			        <option value="1">挂项目</option>
			      </select>
			    </div>
            </div> 
            <div class="layui-form-item">
            	<label class="layui-form-label"><i>*</i><span>转账类型 : </span></label>
                <div class="layui-input-block">
			      <select name="transfertype" lay-filter="transfertype">
			      	<option value="1">转账</option>
			        <option value="0">现金</option>
			      </select>
			    </div>
            </div>    
            <div class="layui-form-item">
                <label class="layui-form-label"><i>*</i><span>开户行 : </span></label>
                <div class="layui-input-block">
        			<input type="text" name="bankname" id="kw" autocomplete="off" class="layui-input" placeholder="请输入银行名称">
        			<div id="append"></div>
        		</div>
            </div> 
              <div class="layui-form-item">
            	<label class="layui-form-label"><i>*</i><span>来源 : </span></label>
                <div class="layui-input-block">
			      <select name="source" lay-filter="source">
			           <option value="0">个人</option>
			        <option value="1">中介</option>      
			      </select>
			    </div>
            </div>
        </div> 
       	<div class="layui-form-item TM-hetong-jilu">
	      	<label class="layui-form-label"><i>*</i><span>备注 : </span></label>
	        <div class="layui-input-block">
	      		<textarea placeholder="证书备注信息" name="remark" class="layui-textarea"></textarea>
	    	</div>
     	</div> 
        </div>
    </form>
	</div>
	
	
	<!-- 资源导入弹窗 -->
	<div id="insertdiv" style="display:none;">
		<form id="insertform" action="/systerm/uploadexcel" method="post" enctype="multipart/form-data">
			<div style="margin-top: 20px;font-size: 18px; text-align: center;">
				<div>
					<blockquote class="layui-elem-quote"><a href="<%=basePath%>upload/resume.xlsx"><b>点击下载</b></a>模版，填写完成后点击上传。</blockquote>
				</div>
				<div style="margin-top: 10px;">
					<input type="file" id="file" name="file" style="border: 1px solid #e6e6e6;height: 31px;">
					<input type="hidden" id="filetype" name="type" value="${customertype}">
					<input type="hidden" id="filestate" name="state" value="${customerstate}">
				</div>	
			</div>
		</form>
	</div>
	
</div>





<script type="text/javascript" src="<%=basePath%>js/customerlist.js?v=<%=callcenterstate%>18"></script>
<script type="text/javascript">

 

//垫款表单
$("#diankuanform").validate({
	rules: {
	 
		arrivaltime : {
			required:true
		},
		totalamount : {
			required:true,
			digits:true
		},
		name : {
			required:true
		},
		cardnumber : {
			required:true
		},
		bankname : {
			required:true
		},
		remark:{
			required:true
		}
		
	},
	messages: {
		 
		arrivaltime : {
			required:"请选择回款时间"
		},
		totalamount : {
			required:"请填写垫款金额",
			digits:"请填写正确金额"
		},
		name : {
			required:"请填写姓名"
		},
		cardnumber : {
			required:"请填写银行卡号"
		},
		bankname : {
			required:"请输入开户行"
		},
		remark:{
			required:"请填写备注"
		}
	},
	errorPlacement: function(error, element) {
		layer.tips(error.text(), element, {
			tips: [2,tipColor],
 		 tipsMore: true
 		});
		}, 
   	 submitHandler: function(formobj) {  
			var values = $("#diankuanform").serialize()
			$.ajax({
				type : "post",
				url : "/customer/savecollectionmoneylog",
				data : values,
				dataType : "json",
				success : function(data){
					if (data == 1) {
						layer.closeAll();
		 				layer.msg('垫款申请成功等待审核，请前往垫款管理查看', {icon: 1});
					} else if (data == 3) {
						layer.msg('垫款申请失败，因为还有在审核中的垫款申请.', {icon: 2});
					} else {
						layer.msg("垫款信息申请失败");
					}
				}
			}); 
	      return  false;
      }
	
});


//垫款申请按钮
	$(".dksqbtn").on("click",function(){
		//重置表单
		document.getElementById("diankuanform").reset();
		var size = $("input:checkbox[name='customcheckbox']:checked").length;
		if(size!=1){
			layer.msg("请选择一条人才记录");
			 return false;
		}
		
		 var id = $("input:checkbox[name='customcheckbox']:checked").val();
	     $("#rcid").val(id);
		 layer.open({
          title:'申请垫款',
          type:1, 
          content:$('#TM-layui-diankuan'),
          btn: ['提交垫款', '取消'],
          shadeClose:true,
          btnAlign:'c',
          area:['95%','95%'],
          yes: function(){ 
        	  $("#diankuanform").submit();
          }
      });
	});
	
	 

	$("#kw").on("keyup",function(){
		var key = $(this).val();
		var html = "";
		if (key != null && key != "") {
			$.ajax({
				type : "post",
				data : {key : key},
				url : "/customer/selectbankname",
				dataType : "json",
				 scriptCharset: 'utf-8',
				success : function(data){
					if (data.length > 0) {
				        $.each(data,function(i, item) {
				        	 html = html + "<div class='item' onmouseenter='getFocus(this)' onClick='getCon(this);'>" + item.bankname + "</div>"
				        });
					} else {
						html = "";
					}
					if(html != ""){
    	      	        $("#append").show().html(html);
    	      	    }else{
    	      	        $("#append").hide().html("");
    	      	    }
				}
			});
		} else {
			return;
		}
		
	});
	
	function getFocus(obj){
  	    $(".item").removeClass("addbg");
  	    $(obj).addClass("addbg");
  	}
  	function getCon(obj){
  	    var value = $(obj).text();
  	    $("#kw").val(value);
  	    $("#append").hide().html("");
  	}
	
</script>
<script type="text/javascript" src="<%=basePath%>js/monitor.js"></script>
</body>
</html>